<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<div class="middle padtop10 myclear">
	<div class="page-content">
		
		<!-- bread crumb -->
		<p id="bread-crumb">
			<a href="<?php echo base_url();?>">
				<?php echo $lang['home']?>
			</a>
			<a href="<?php echo site_url('user/listzone');?>">
				<?php echo $lang['zone']?>
			</a>
		</p><!-- end bread crumb -->
		
		<h3>
			<?php echo $lang['zone']?>
		</h3>
		<br style="clear:both;" />
		
		<?php
		$msg = trim($this->input->get('msg',true));
		if($msg != ''){
		?>
		<p class="msg"><?php echo $msg;?></p>
		<br />
		<?php }?>
		
		<div class="group-detail">
			<form name="frmGroup" action="<?php echo site_url('user/savezone')?>" method="post" onsubmit="return checkSubmit();">
				<table>
				<tr>
					<td>
						<p class="login-label padtop10">
							<?php echo $lang['zone_name']?> <span class="require">*</span>
						</p>
						<p class="padbottom2">
							<input class="login-input" type="text" id="zone_name" name="zone_name" value="<?php echo $zone_name?>" />
						</p>
						
						<p class="login-label padtop10">
							<?php echo $lang['chanel_name']?> <span class="require">*</span>
						</p>
						<p class="padbottom2">
							<select name="chanel" id="chanel">
							<option value="0"><?php echo $lang['select']?></option>
							<?php foreach ($chanel as $cn){?>
								<option value="<?php echo $cn['channelid']?>" <?php if($chanel_id == $cn['channelid']) echo 'selected=true'?>>
									<?php echo $cn['name']?>
								</option>
							<?php }?>
							</select>
						</p>
						
						<p class="login-label padtop10">
							<?php echo $lang['description']?>
						</p>
						<p class="padbottom2">
							<textarea name="zone_des" id="zone_des" style="width: 300px; height: 140px; border: 1px solid #ddd"><?php echo $zone_des?></textarea>
						</p>
						
						<p class="login-label padtop10">
							<input type="hidden" name="zone_id" value="<?php echo $zone_id?>" />
							<input type="submit" name="_submit" value="<?php echo $lang['save']?>" />
							<input type="button" name="_cancel" value="<?php echo $lang['cancel']?>" onclick="window.location.href='<?php echo site_url('user/listzone')?>'" />
						</p>
					</td>
					<td style="padding-left:20px">
						<p class="login-label padtop10">
							<?php echo $lang['zone_format']?>  <span class="require">*</span>
						</p>
						<p class="padbottom2">
						<select id="format" name="format" style="width: 300px; height: 250px; border: 1px solid #ddd" multiple="multiple">
						<?php foreach($items as $item){;?>
							<option value="<?php echo $item->id?>" <?php if($item->id == $format_id) echo "selected=true"?>><?php echo $item->name?></option>
						<?php }?>
						</select>
						</p>
					</td>
				</tr>
				</table>
			</form>
		</div>
	</div>
</div><br />
<script language="javascript">
function checkSubmit()
{
	if($('#zone_name').val() == '')
	{
		alert('<?php echo $lang['enter_zone_name']?>');
		return false;
	}
	if($('#chanel').val() == '0')
	{
		alert('<?php echo $lang['enter_chanel_zone']?>');
		return false;
	}
	if($('#format option:selected').length == 0)
	{
		alert('<?php echo $lang['enter_zone_format']?>');
		return false;
	}
	return true;
}
</script>